const config = require('../config');
const mongoose = require('mongoose');
const dbUrl = `mongodb://${config.mongoDb.user}:${config.mongoDb.password}@${config.mongoDb.host}/${config.mongoDb.dbName}`;
mongoose.connect(dbUrl);
const db = mongoose.connection;
db.on('error', console.error.bind(console, 'connection error:'));
db.once('open', function() {
 console.log('连接成功');
});